define(
		[ "PDAppDir/properties", "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar" ],
		function(Properties, Util, Tool, Slidebar) {
			function auditSupportInit($scope, $compile){
				return new auditSupport($scope, $compile);
			};
			function auditSupport($scope, $compile){
				this.$scope = $scope;
				this.$compile = $compile;
				this.cache = {
					fileServer: Properties.URL_FILE_SERVER_URL
				}
			};
			auditSupport.fn = auditSupport.prototype;
			auditSupport.fn.digest = function(){
				 this.$scope.$digest();
			};
			auditSupport.fn.init = function(id){
				var _this = this;
				_this.entity = {};
				$.ajax({
					url : getServer() + "/flea/hclv/guide/getGuideInfo.htmls",
					data: {
						guideId: id
					},
					success : function(data) {
						// console.info(data);
						if(data.status == 200){
							_this.entity = $.extend(_this.entity, data.data);
							_this.digest();
						}
					}
				});
				 this.$scope.$digest();
			};
			auditSupport.fn.run = function(id) {
				var _this = this;
				_this.init(id);
				this.slidebars = Slidebar({
					size : 'lg',
					url : getServer() + "/static/app/register/auditGuideInfos/views/audit.html",
					$scope: this.$scope,
					$compile: this.$compile,
					afterLoad : function($Panel) {
						_this.initialization();
					}
				});
			};
			auditSupport.fn.initialization = function(){
				this.baseInit();
			};
			auditSupport.fn.baseInit = function() {
//				var _this = this;
				//加载code
//				$.ajax({
//					url : getServer() + "/flea/hclv/guide/getGuideInfo.htmls",
//					method : 'get',
//					data: {
//						guideId: _this.entity.id
//					},
//					success : function(data) {
//						_this.bind = data;
//						_this.digest();
//					}
//				});
			};
			auditSupport.fn.save = function(label) {
				var _this = this;
				if(label == 'yes'){
					Util.confirm("确认通过审核？", function() {
						$.ajax({
		                    url : getServer() + "/flea/hclv/guide/updateAuditStatus.htmls",
		                    data : {
		                        guideId : _this.entity.id
		                    },
		                    success : function(data) {
		                    	_this.$scope.grid.refresh();
		                        Util.alert(data.message);
		                        _this.slidebars.close();
		                    }
						});
					});
				}else{
					Util.confirm("确认未通过审核？", function() {
						$.ajax({
		                    url : getServer() + "/flea/hclv/guide/updateAuditStatus.htmls",
		                    data : {
		                    	notPassCause: _this.entity.notPassCause,
								guideId :_this.entity.id
		                    },
		                    success : function(data) {
		                    	_this.$scope.grid.refresh();
		                        Util.alert(data.message);
		                        _this.slidebars.close();
		                    }
						});
					});
				}
			};
			return auditSupportInit;
		});